using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Needle.Utils.Threading;
using System.Threading;

namespace Needle.Utils.Collections
{
    /// <summary>
    /// Queue interface, no enumerator is provided because
    /// that would complicate the threadsafe implementations
    /// too much.
    /// </summary>
    public interface IQueue<T>
    {
        /// <summary>
        /// The current number items in the queue
        /// </summary>
        int Count { get; }
        /// <summary>
        /// Enqueues an item 
        /// This method throws if the queue is in a non-enqueue-able state.
        /// </summary>
        void Enqueue(T item);
        /// <summary>
        /// Enqueues an item, never throws.
        /// </summary>
        bool TryEnqueue(T item);
        /// <summary>
        /// Dequeue an item, throws an InvalidOperationException when the queue
        /// is empty.
        /// </summary>
        T Dequeue();
        /// <summary>
        /// Tries to dequeue an item, never throws 
        /// </summary>
        bool TryDequeue(out T item);
    }

}
